package com.scau.RBAC.service;

import com.scau.RBAC.model.entity.Permission;
import java.util.List;

/**
 * 权限服务接口，定义权限管理的业务逻辑方法
 */
public interface PermissionService {
    // 权限CRUD操作
    Permission createPermission(Permission permission);
    void updatePermission(Permission permission);
    void deletePermission(Long permissionId);
    Permission getPermissionById(Long permissionId);
    Permission getPermissionByCode(String permissionCode);
    List<Permission> getAllPermissions();
    List<Permission> getPermissionsByCondition(Permission condition);

    // 权限树相关
    List<Permission> getPermissionTree(Long parentId);
    List<Permission> buildPermissionTree(List<Permission> permissions);
    Permission findPermissionByPath(String resourcePath);

    // 用户权限相关
    List<Permission> getUserPermissions(Long userId);
    boolean hasUserPermission(Long userId, String permissionCode);
    boolean hasUserPermissionPath(Long userId, String resourcePath);

    // 角色权限相关
    List<Permission> getRolePermissions(Long roleId);
    List<String> getRolePermissionCodes(Long roleId);
    List<String> getUserPermissionCodes(Long userId);

    // 批量操作
    void batchCreatePermissions(List<Permission> permissions);
    void batchUpdatePermissionStatus(List<Long> permissionIds, boolean status);
    boolean isPermissionInUse(Long permissionId);
}
